import http from '../util/http';

const getCountTableList = data => http.getData(data, '/api/statistics/pushInfo');
const getCountLine = data => http.getData(data, '/api/statistics/numOfPushes');
const getCountPie = data => http.getData(data, '/api/statistics/publicAndNumPushes');

// 统计下用户管理
const getUserPhone = data => http.getData(data, '/api/receiver/query');
const addUserPhone = data => http.postData(data, '/api/receiver/create');
const editUserPhone = data => http.postData(data, '/api/receiver/edit');
const deleteUserPhone = ({ id: userId }) => http.postData({}, `/api/receiver/delete/${userId}`);

// 日活统计
const getDayPlay = data => http.getData(data, '/api/dauStatistics/getDauStatisticInfo');
const getAuthorizerInfo = data => http.getData(data, '/api/dauStatistics/getAuthorizerInfoNickName');

// 月活统计
const getMouthPlay = data => http.getData(data, '/api/mauStatistics/getMauStatisticInfo');

// 留存率
const getRetentionCount = data => http.getData(data, '/api/fansRetentionStatistics/getRetentionCountInfo');
const getDaySubscribe = data => http.getData(data, '/api/fansRetentionStatistics/getDaySubscribeInfo');
const getRetentionRateInfo = data => http.getData(data, '/api/fansRetentionStatistics/getRetentionRateInfo');

// 添加回调地址
const setDataUrl = data => http.postData(data, '/api/publicAccounts/setDataUrl');

// 黑名单
const blackList = data => http.getData(data, '/api/group/blacklist/userList');
const blackCreate = data => http.postData(data, '/api/group/blacklist/create');
const blackUpdate = data => http.postData(data, '/api/group/blacklist/updateState');

// 白名单
const whiteList = data => http.getData(data, '/api/group/whitelist/list');
const whiteCreate = data => http.postData(data, '/api/group/whitelist/create');
const whiteUpdate = data => http.postData(data, '/api/group/whitelist/updateState');

// 黑名单策略
const blackTacticsList = data => http.getData(data, '/api/group/blackliststrategy/list');
const blackTacticsCreate = data => http.postData(data, '/api/group/blackliststrategy/create');
const blackTacticsUpdate = data => http.postData(data, '/api/group/blackliststrategy/updateStrategy');

export default {
  getCountTableList,
  getCountLine,
  getCountPie,
  getUserPhone,
  addUserPhone,
  editUserPhone,
  deleteUserPhone,
  getDayPlay,
  getAuthorizerInfo,
  getMouthPlay,
  getRetentionCount,
  getDaySubscribe,
  getRetentionRateInfo,
  setDataUrl,
  blackList,
  blackCreate,
  blackUpdate,
  whiteList,
  whiteCreate,
  whiteUpdate,
  blackTacticsList,
  blackTacticsCreate,
  blackTacticsUpdate
};
